package com.tm.servicemsm.controller;

import com.tm.servicemsm.demos.ChargerLocation;

import java.util.List;

/**
 * 2024/7/17 使用地图服务API查询充电桩 Cjj
 */
public class ChargerLocator {
    private MapService mapService;

    public ChargerLocator(MapService mapService){
        this.mapService=mapService;
    }

    public List<ChargerLocation> findChargeLocations(double latitude,double longitude,int searchRadius){
        return mapService.searchChargerLocations(latitude,longitude,searchRadius);
    }

    public static void main(String[] args) {
        MapService mapService = new MapService();//创建地图服务实例
        ChargerLocator chargerLocator = new ChargerLocator(mapService);

        double latitude=37.7749;//纬度
        double longitude=-122.4194;//经度
        int searchRadius=1000;//搜索半径,单位为米

        List<ChargerLocation> chargeLocations = chargerLocator.findChargeLocations(latitude, longitude, searchRadius);


        //处理充电桩位置信息
        for (ChargerLocation chargeLocation : chargeLocations) {
            System.out.println(chargeLocation);
        }

    }
}
